package com.ruoyi.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GaAlarmUpdateRecord;
import com.ruoyi.system.service.IGaAlarmUpdateRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 报警信息更新记录Controller
 * 
 * @author wzp
 * @date 2021-11-26
 */
@RestController
@RequestMapping("/kyga/alarmUpdateRecord")
public class GaAlarmUpdateRecordController extends BaseController
{
    @Autowired
    private IGaAlarmUpdateRecordService gaAlarmUpdateRecordService;

    /**
     * 查询报警信息更新记录列表
     */
    @PreAuthorize("@ss.hasPermi('kyga:alarmUpdateRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(GaAlarmUpdateRecord gaAlarmUpdateRecord)
    {
        startPage();
        List<GaAlarmUpdateRecord> list = gaAlarmUpdateRecordService.selectGaAlarmUpdateRecordList(gaAlarmUpdateRecord);
        return getDataTable(list);
    }

    /**
     * 导出报警信息更新记录列表
     */
    @PreAuthorize("@ss.hasPermi('kyga:alarmUpdateRecord:export')")
    @Log(title = "报警信息更新记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GaAlarmUpdateRecord gaAlarmUpdateRecord)
    {
        List<GaAlarmUpdateRecord> list = gaAlarmUpdateRecordService.selectGaAlarmUpdateRecordList(gaAlarmUpdateRecord);
        ExcelUtil<GaAlarmUpdateRecord> util = new ExcelUtil<GaAlarmUpdateRecord>(GaAlarmUpdateRecord.class);
        return util.exportExcel(list, "报警信息更新记录数据");
    }

    /**
     * 获取报警信息更新记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('kyga:alarmUpdateRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gaAlarmUpdateRecordService.selectGaAlarmUpdateRecordById(id));
    }

    /**
     * 新增报警信息更新记录
     */
    @PreAuthorize("@ss.hasPermi('kyga:alarmUpdateRecord:add')")
    @Log(title = "报警信息更新记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GaAlarmUpdateRecord gaAlarmUpdateRecord)
    {
        return toAjax(gaAlarmUpdateRecordService.insertGaAlarmUpdateRecord(gaAlarmUpdateRecord));
    }

    /**
     * 修改报警信息更新记录
     */
    @PreAuthorize("@ss.hasPermi('kyga:alarmUpdateRecord:edit')")
    @Log(title = "报警信息更新记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GaAlarmUpdateRecord gaAlarmUpdateRecord)
    {
        return toAjax(gaAlarmUpdateRecordService.updateGaAlarmUpdateRecord(gaAlarmUpdateRecord));
    }

    /**
     * 删除报警信息更新记录
     */
    @PreAuthorize("@ss.hasPermi('kyga:alarmUpdateRecord:remove')")
    @Log(title = "报警信息更新记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gaAlarmUpdateRecordService.deleteGaAlarmUpdateRecordByIds(ids));
    }
}
